import time

import requests
from selenium import webdriver
from selenium.webdriver.common.by import By

if __name__ == '__main__':
    driver = webdriver.Chrome()
    driver.get('http://liuyan.people.com.cn/threads/list?fid=5210&formName=%E4%B8%AD%E5%8D%8E%E5%85%A8%E5%9B%BD%E6%80%BB%E5%B7%A5%E4%BC%9A%E5%85%9A%E7%BB%84%E4%B9%A6%E8%AE%B0%E3%80%81%E5%89%AF%E4%B8%BB%E5%B8%AD%E3%80%81%E4%B9%A6%E8%AE%B0%E5%A4%84%E7%AC%AC%E4%B8%80%E4%B9%A6%E8%AE%B0%E5%BE%90%E7%95%99%E5%B9%B3&position=1')
    time.sleep(5)
    data_lis = driver.find_elements(By.XPATH,'//ul[@class="replyList"]/li')
    #
    for li in data_lis:
        t1 = li.find_element(By.XPATH, './div[@class="tabList fl"]/h1').text
        t2 = li.find_element(By.XPATH, './p[@class="replyContent"]/span[1]').text
        print(t2)
    time.sleep(5)
    driver.quit()
